<?php if (!defined('THINK_PATH')) exit();?><!-- Main content -->
    <section class="content">
      <!-- Your Page Content Here -->
	<div class="col-md-6">
          <!-- Horizontal Form -->
          <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title">修改系统用户</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal" id="editadmin" method="post" action="/index.php/Admin/admin/editadmin">
              <input type="hidden" name="userid" value="<?php echo ($user["userid"]); ?>">
              <div class="box-body">
                <div class="form-group">
                  <label for="inputname" class="col-sm-2 control-label">账号</label>
				  <div class="col-sm-10">
                    <input type="text" class="form-control" name="username" id="inputname" value="<?php echo ($user["username"]); ?>">
                  </div>
                </div>

				<div class="form-group">
                  <label for="inputpw" class="col-sm-2 control-label">新密码</label>
                  <div class="col-sm-10">
                    <input type="password" class="form-control" name="password" id="inputpw">
                  </div>
                </div>

				<div class="form-group">
                  <label for="inputckpw" class="col-sm-2 control-label">确认新密码</label>
                  <div class="col-sm-10">
                    <input type="password" class="form-control" name="checkpw" id="inputckpw">
                  </div>
                </div>

				<div class="form-group">
                  <label class="col-sm-2 control-label">所属用户组</label>
                  <div class="col-sm-10">
					     <select class="form-control" name="group_id">
                  <?php if(is_array($group)): $i = 0; $__LIST__ = $group;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>" <?php if($user[groupid] == $vo[id]): ?>selected="selected"<?php endif; ?> ><?php echo ($vo["title"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
                  </div>
                </div>

              </div>
              <!-- /.box-body -->
              <div class="box-footer">
                <button type="button" id="refresh" class="btn btn-default">不理返回</button>
                <button type="button" id="subtn" class="btn btn-info pull-right">确定</button>
              </div>
              <!-- /.box-footer -->
            </form>
          </div>
          <!-- /.box -->
 
        </div>
    </section>
    <!-- /.content -->
<script type="text/javascript">
  $("#subtn").on("click",function(){
      var formdata = $("#editadmin").serialize();
      var url = $("#editadmin").attr("action");
      $.post(url,formdata,function(data){
          if (data == '1') {
            alert("修改成功");
            refresh();
          }else{
            alert("修改失败");
          }
      });
  });

  $("#refresh").on("click",function(){
      refresh();
  });

  function refresh(){
      $("#mcont").load("/index.php/Admin/admin/adminlist");
  }
</script>